import {HttpException, HttpStatus} from "@nestjs/common";
import {MyHttpStatusEnum} from "../enum/MyHttpStatusEnum";

/**
 * 自定义Http异常
 */
export class MyHttpException extends HttpException {
    private readonly code: MyHttpStatusEnum;

    constructor(msg:string, code: MyHttpStatusEnum, status?: HttpStatus) {
        super(msg, status || HttpStatus.OK);
        this.code = code;
    }

    getCode() {
        return this.code;
    }
}
